home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20021006-20030409
/
000319_b.stewart@bom.gov.au_Mon Feb 17 19:39:16 EST 2003.msg
< prev
next >
Wrap
Text File
|
2020-01-01
|
15KB
|
336 lines
Article: 14115 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!phl-feed.news.verio.net!iad-feed.news.verio.net!ord-feed.news.verio.net!stl-feed.news.verio.net!news.cc.ukans.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!news1.optus.net.au!optus!ken-transit.news.telstra.net!news.telstra.net!vicpull1.telstra.net!not-for-mail
Message-ID: <3E517E98.D89D779C@bom.gov.au>
From: Bruce Stewart <b.stewart@bom.gov.au>
X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Running multiple kermit scripts on one connection
References: <775a2ab0.0302171458.f8f21f9@posting.google.com> <b2rrbl$ks3$1@watsol.cc.columbia.edu>
Content-Type: multipart/alternative;
boundary="------------0E4B00F8CCF00119C91BFB8D"
Lines: 314
Date: Tue, 18 Feb 2003 11:30:17 +1100
NNTP-Posting-Host: 134.178.5.131
X-Complaints-To: abuse@telstra.net
X-Trace: vicpull1.telstra.net 1045527997 134.178.5.131 (Tue, 18 Feb 2003 11:26:37 EST)
NNTP-Posting-Date: Tue, 18 Feb 2003 11:26:37 EST
Organization: Customer of Telstra Internet Direct
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14115
--------------0E4B00F8CCF00119C91BFB8D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
OK, that second method sounds like it would do the job. I will give it a try
but first I want to ask you another question.
I have been looking at the documentation and found the following under
Command-line options:
-l _number
where number refers to the Windows device handle for a communication
connection that has already been opened by another process.
So, assuming I could open a device handle to the local modem say,
within my program, and pass that into each instance of kermit opened to
run each script, that should also do the job I think.
I tried the following to test it:
1-I opened a kermit instance, and opened a connection to com port
2, which is where the modem is connected.
2-I then tried to open another instance of kermit using the follwoing
line:
run k95 -l _\v(ttyfd),
but got the following respose when the other kermit instance opened:
"can't open device",
Now, I don't know whether the file descriptor is the same as the
windows device handle. Maybe they are totally different. I will try doing
it from the program, opening a device handle and passing that into each
kermit instance. Hopefully that will work.
Do you know anything that may be important regarding this way?
Frank da Cruz wrote:
> In article <775a2ab0.0302171458.f8f21f9@posting.google.com>,
> Minty <metceed@yahoo.com> wrote:
> : I'm trying to run multiple kermit scripts over one dial-up connection.
> : More specifically:
> :
> : I am writing a program that will automatically send an alert. One the
> : the ways it sends an alert is via an sms message. I have an account
> : with an pstn-to-sms gateway provider. So I can dial-up this gateway
> : modem, and using the TAP protocol, I can send sms messages.
> :
> : What I want to do is control, within my program, the 2 main aspects of
> : the sending process. The 'loggin on' part, and the 'sending messages
> : part'. I already have a kermit script that does both. I want to
> : seperate those to parts and call them seperately from my program. The
> : reason is that there could be many messages going out for the one
> : connection. This is decided at run-time. Another reason is so that the
> : program can know which alerts got sent and which didn't.
> :
> : So, if for example I'm sending out 2 alerts, the steps would be as
> : follows:
> :
> : 1-The program would run a kermit script, that opens connection from
> : local pc to local modem, dials the gateway modem and logs on, as per
> : the TAP protocol. The script would be called with the gateway provider
> : number as parameter.
> :
> : 2-Then the program would run another kermit script, that sends
> : messages as per TAP protocol, with the message and sms number as
> : parameters, noting the exit code.
> :
> : 3-It would again call the same send script with another message and
> : another number as parameter, again noting the exit code.
> :
> : 4-It calls another scipt, that logs off the connection to the gateway
> : modem, and also closes connection from local pc to local modem.
> :
> : Now, the problem I have noted with running multiple kermit scripts, is
> : that at the end of running one script, it closes the connection to the
> : gateway modem and also the connection from the local pc to the local
> : modem.
> :
> : I'm using the latest kermit 95 version on a Windows 2000 machine.
> :
> : Anyone have any ideas on how I could do this? I'm sure it's only a
> : setting I would have to set with kermit, but I haven't found it.
> :
> : One idea I did try was to manually open an instance of kermit and open
> : connection to local modem manually. Then call the other scripts to use
> : this connection, but they wouldn't use it.
> :
> Ideally you'd like to be able to start Kermit and then send it messages
> when you want it to do something. Unfortunately, Kermit doesn't have a
> way to wait for or send messages, so we have to devise a cunning plan.
>
> One idea would be to turn your application upside down and let Kermit
> control the sequence of events. For example, it could make the call, log
> in, and then run your application with a command-line argument that says
> "OK I'm logged in, now what?" and waits for your application to terminate.
> At this point it can dispatch based on the return code, perhaps looking in
> a prearranged file for instructions. Repeat as needed.
>
> If that's not practical, there is a little-known way of making Kermit wait
> for an event:
>
> WAIT <interval-or-clock-time> FILE CREATION <filename>
>
> ("help wait" for details.) This is admittedly a hack, and it would
> require the same thing in the other direction, because at this point
> Kermit is still running.
>
> Thus your application would have to spawn Kermit asynchronously, then
> wait for a prearranged file to appear, which Kermit would create just
> before doing the WAIT. Then your application would do whatever it does,
> and then when it's ready for Kermit to send a message, it would create
> another prearranged file, the one that Kermit is WAITing for. Obviously,
> it would be handy if this file contained the message details.
>
> So the Kermit script would go about like this:
>
> Make the call and log in.
> If this failed, return a failure code.
> If it succeeds, create the "I'm logged in" file.
> While true {
> Wait for message file.
> If message file says "Finished" {
> delete the "I'm logged in" file
> Hang up and exit.
> } else {
> send the message.
> delete (or rename) the message file
> }
> }
>
> Meanwhile your application would:
>
> Spawn Kermit asynchronously
> Wait for the "I'm logged in" file
> While true {
> Make sure "I'm logged in" file still exists.
> Get a message to send.
> Create message file.
> Wait for message file to disappear.
> }
>
> Does this help? It's not the fashiable TLA du jour but we've never been
> particularly concerned with fashion :-)
>
> Obviously refinements are possible, such as queueing and various forms of
> bulletproofing.
>
> - Frank
--------------0E4B00F8CCF00119C91BFB8D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
OK, that second method sounds like it would do the job. I will give it
a try
<br>but first I want to ask you another question.
<p>I have been looking at the documentation and found the following under
<br>Command-line options:
<p> -l _<i>number</i><i></i>
<p>where <i>number</i> refers to the Windows device handle for a communication
<br>connection that has already been opened by another process.
<p>So, assuming I could open a device handle to the local modem say,
<br>within my program, and pass that into each instance of kermit opened
to
<br>run each script, that should also do the job I think.
<p>I tried the following to test it:
<br>1-I opened a kermit instance, and opened a connection to com port
<br> 2, which is where the modem is connected.
<br>2-I then tried to open another instance of kermit using the follwoing
<br> line:
<br> run k95 -l _\v(ttyfd),
<p> but got the following respose when the
other kermit instance opened:
<br>
<br> "can't open device",
<p>Now, I don't know whether the file descriptor is the same as the
<br>windows device handle. Maybe they are totally different. I will try
doing
<br>it from the program, opening a device handle and passing that into
each
<br>kermit instance. Hopefully that will work.
<p>Do you know anything that may be important regarding this way?
<p>Frank da Cruz wrote:
<blockquote TYPE=CITE>In article <775a2ab0.0302171458.f8f21f9@posting.google.com>,
<br>Minty <metceed@yahoo.com> wrote:
<br>: I'm trying to run multiple kermit scripts over one dial-up connection.
<br>: More specifically:
<br>:
<br>: I am writing a program that will automatically send an alert. One
the
<br>: the ways it sends an alert is via an sms message. I have an account
<br>: with an pstn-to-sms gateway provider. So I can dial-up this gateway
<br>: modem, and using the TAP protocol, I can send sms messages.
<br>:
<br>: What I want to do is control, within my program, the 2 main aspects
of
<br>: the sending process. The 'loggin on' part, and the 'sending messages
<br>: part'. I already have a kermit script that does both. I want to
<br>: seperate those to parts and call them seperately from my program.
The
<br>: reason is that there could be many messages going out for the one
<br>: connection. This is decided at run-time. Another reason is so that
the
<br>: program can know which alerts got sent and which didn't.
<br>:
<br>: So, if for example I'm sending out 2 alerts, the steps would be as
<br>: follows:
<br>:
<br>: 1-The program would run a kermit script, that opens connection from
<br>: local pc to local modem, dials the gateway modem and logs on, as
per
<br>: the TAP protocol. The script would be called with the gateway provider
<br>: number as parameter.
<br>:
<br>: 2-Then the program would run another kermit script, that sends
<br>: messages as per TAP protocol, with the message and sms number as
<br>: parameters, noting the exit code.
<br>:
<br>: 3-It would again call the same send script with another message and
<br>: another number as parameter, again noting the exit code.
<br>:
<br>: 4-It calls another scipt, that logs off the connection to the gateway
<br>: modem, and also closes connection from local pc to local modem.
<br>:
<br>: Now, the problem I have noted with running multiple kermit scripts,
is
<br>: that at the end of running one script, it closes the connection to
the
<br>: gateway modem and also the connection from the local pc to the local
<br>: modem.
<br>:
<br>: I'm using the latest kermit 95 version on a Windows 2000 machine.
<br>:
<br>: Anyone have any ideas on how I could do this? I'm sure it's only
a
<br>: setting I would have to set with kermit, but I haven't found it.
<br>:
<br>: One idea I did try was to manually open an instance of kermit and
open
<br>: connection to local modem manually. Then call the other scripts to
use
<br>: this connection, but they wouldn't use it.
<br>:
<br>Ideally you'd like to be able to start Kermit and then send it messages
<br>when you want it to do something. Unfortunately, Kermit doesn't
have a
<br>way to wait for or send messages, so we have to devise a cunning plan.
<p>One idea would be to turn your application upside down and let Kermit
<br>control the sequence of events. For example, it could make the
call, log
<br>in, and then run your application with a command-line argument that
says
<br>"OK I'm logged in, now what?" and waits for your application to terminate.
<br>At this point it can dispatch based on the return code, perhaps looking
in
<br>a prearranged file for instructions. Repeat as needed.
<p>If that's not practical, there is a little-known way of making Kermit
wait
<br>for an event:
<p> WAIT <interval-or-clock-time> FILE CREATION <filename>
<p>("help wait" for details.) This is admittedly a hack, and it would
<br>require the same thing in the other direction, because at this point
<br>Kermit is still running.
<p>Thus your application would have to spawn Kermit asynchronously, then
<br>wait for a prearranged file to appear, which Kermit would create just
<br>before doing the WAIT. Then your application would do whatever
it does,
<br>and then when it's ready for Kermit to send a message, it would create
<br>another prearranged file, the one that Kermit is WAITing for.
Obviously,
<br>it would be handy if this file contained the message details.
<p>So the Kermit script would go about like this:
<p> Make the call and log in.
<br> If this failed, return a failure code.
<br> If it succeeds, create the "I'm logged in" file.
<br> While true {
<br> Wait for message file.
<br> If message file says "Finished" {
<br> delete the "I'm
logged in" file
<br> Hang up and
exit.
<br> } else {
<br> send the message.
<br> delete (or rename)
the message file
<br> }
<br> }
<p>Meanwhile your application would:
<p> Spawn Kermit asynchronously
<br> Wait for the "I'm logged in" file
<br> While true {
<br> Make sure "I'm logged in" file still
exists.
<br> Get a message to send.
<br> Create message file.
<br> Wait for message file to disappear.
<br> }
<p>Does this help? It's not the fashiable TLA du jour but we've never
been
<br>particularly concerned with fashion :-)
<p>Obviously refinements are possible, such as queueing and various forms
of
<br>bulletproofing.
<p>- Frank</blockquote>
</html>
--------------0E4B00F8CCF00119C91BFB8D--